<?php

namespace App\Http\Requests\Logic\Department;

use App\Models\User;
use Illuminate\Foundation\Http\FormRequest;

class UpdateResource extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
		/**
		 * @var User $user
		 */
		$user = $this->user();
		$company = $user->getCompany();
		if ($company->id === $this->department->company_id) {
			return true;
		}
        return false;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
			'name' => 'required'
        ];
    }
}
